=link_to("充值", "#", class: 'button', id: "audit")
=link_to("返利", "#", class: 'button',id: 'reject')
=link_to("发布", "/admin/companies/#{params[:company_id]}/wallets/#{params[:id]}/pull", class: 'button', method: :post)
=link_to("扣款", "/admin/companies/#{params[:company_id]}/wallets/#{params[:id]}/publish", class: 'button', method: :post)
#recharge{class: 'modal2 fade',tabindex: -1, role: 'dialog',"aria-labelledby": 'myModalLabel'}
  = semantic_form_for [:admin, resource.records.new(company_id: params[:company_id])], builder: ActiveAdmin::FormBuilder do |f|
    = f.inputs '充值' do
      = f.input :company_id,as: :hidden
      = f.input :wallet_id,as: :hidden
      = f.input :action,as: :hidden,input_html: {value: :recharge}
      = f.input :title,as: :hidden,input_html: {value: '财务充值'}
      = f.input :amount
      = f.input :pay_type,as: :select,collection: %w(银行转账-兴业银行嘉定支行 支付宝-team@aidong.me 微信-126351601A 微信-1432701802 应收),include_blank: false
      = f.input :remark
    %br
    = f.submit("确定",id: "rechargeBtn")
#rebate{class: 'modal2 fade',tabindex: -1, role: 'dialog',"aria-labelledby": 'myModalLabel'}
  = semantic_form_for [:admin, resource.records.new(company_id: params[:company_id])], builder: ActiveAdmin::FormBuilder do |f|
    = f.inputs '返利' do
      = f.input :company_id,as: :hidden
      = f.input :wallet_id,as: :hidden
      = f.input :action,as: :hidden,input_html: {value: :rebate}
      = f.input :title,as: :hidden,input_html: {value: '课程金额返回'}
      = f.input :amount
      = f.input :remark
    %br
    = f.submit("确定",id: "rebateBtn")
:javascript
  $(function(){
    var recharge =  $("#recharge");
    $("#audit").on("click",function(e){
      e.preventDefault();
      recharge.modal('view',{
        speed : 200,
        easing : 'easeInOutElastic',
        animation : 'top height width',
        position: '10% auto',
        overlayClose : true,
        on : 'click',
        overlayColor : '#ccc',
        overlayOpacity : .9,
        close : '.close'
      });
    })



    var rebate = $("#rebate");
    $("#reject").on("click",function(e){
      e.preventDefault();
      rebate.modal('view',{
        speed : 200,
        easing : 'easeInOutElastic',
        animation : 'top height width',
        position: '10% auto',
        overlayClose : true,
        on : 'click',
        overlayColor : '#ccc',
        overlayOpacity : .9,
        close : '.close'
      });
    })
  })